import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XhljNewsForm, XhljNewsQuery, XhljNewsVo } from '@/api/xhlj/model/newsModel';
import { request } from '@/utils/request';

// 查询大会新闻列表
export function listNews(query?: XhljNewsQuery) {
  return request.get<TableDataInfo<XhljNewsVo>>({
    url: '/xhlj/news/list',
    params: query,
  });
}

// 查询大会新闻详细
export function getNews(newsId: number) {
  return request.get<R<XhljNewsVo>>({
    url: `/xhlj/news/${newsId}`,
  });
}

// 新增大会新闻
export function addNews(data: XhljNewsForm) {
  return request.post<R<void>>({
    url: '/xhlj/news',
    data,
  });
}

// 修改大会新闻
export function updateNews(data: XhljNewsForm) {
  return request.put<R<void>>({
    url: '/xhlj/news',
    data,
  });
}

// 删除大会新闻
export function delNews(newsIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xhlj/news/${newsIds}`,
  });
}
